﻿using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using Model;
using FubiManger.Controls;

namespace FubiManger.UI
{
    partial class PacketRecordForm : Smobiler.Core.Controls.MobileForm
    {
        public PacketRecordForm() : base()
        {
            //This call is required by the SmobilerForm.
            InitializeComponent();
        }
        /// <summary>
        /// 商户ID
        /// </summary>
        public string merchantid { get; set; }
        /// <summary>
        /// 活动ID
        /// </summary>
        public string pr_pactiyid { get; set; }
        /// <summary>
        /// 记录集合
        /// </summary>
        List<ms_packetrecord> redlist = new List<ms_packetrecord>();
        private void panclose_Press(object sender, EventArgs e)
        {
            this.Close();
        }

        private void PacketRecordForm_Load(object sender, EventArgs e)
        {
            
            ms_packet packet = packetDal.Querybyid(pr_pactiyid);//通过活动ID查详情
            redlist = packetrecordDal.Querybyid(pr_pactiyid);
            lblmoney.Text = packet.p_money;//红包金额
            if (packet.p_way == "2")
                lblway.Text = "本地红包";
            else
                lblway.Text = "全网红包";
            if (redlist.Count == 0)
            {
                lbltxt.Text = packet.p_ketcount + "个红包共" + packet.p_money + "元" + "  暂无人领取";
            }
            else
                lbltxt.Text = packet.p_ketcount + "个红包共" + packet.p_money + "元";
           
            panrecord.Height = redlist.Count * 48;
            for (int i = 0; i < redlist.Count; i++)
            {
                packetrecordcontrol con = new packetrecordcontrol();
                con.pr_packet = redlist[i].pr_packet;//红包金额
                con.date = Convert.ToDateTime(redlist[i].pr_date);
                con.nickanme = redlist[i].pr_nickname;//昵称
                panrecord.Controls.Add(con);
            }
        }
    }
}